﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;

namespace SlaktDataReader
{
    [Serializable]
    public class Book
    {
        private Guid ID;
        private string fileName;
        private string friendlyName;
        private BookTypes bookType;
        private Guid location;
        private string period;
        private string author;
        private string license;
        private string source;
        private int records;
        private string updated;

        public Guid BookID { get { return ID; } set { ID = value; IsChanged = true; } }
        public string FileName { get { return fileName; } set { fileName = value; IsChanged = true; } }
        public string FriendlyName { get { return friendlyName; } set { friendlyName = value; IsChanged = true; } }
        public BookTypes BookType { get { return bookType; } set { bookType = value; IsChanged = true; } }
        public Guid Location { get { return location; } set { location = value; IsChanged = true; } }
        public string Period { get { return period; } set { period = value; IsChanged = true; } }
        public string Author { get { return author; } set { author = value; IsChanged = true; } }
        public string License { get { return license; } set { license = value; IsChanged = true; } }
        public string Source { get { return source; } set { source = value; IsChanged = true; } }
        public string LastUpdated { get { return updated; } set { updated = value; IsChanged = true; } }
        public int Records { get { return records; } set { records = value; IsChanged = true; } }

        public Book()
        {
            ID = Guid.NewGuid();
            bookType = BookTypes.Born;
            IsChanged = false;
        }

        [XmlIgnore]
        public bool IsChanged { get; set; }

    }

    public enum BookTypes { 
        Born = 0, // "F", 
        Dead = 1, //"D", 
        Marriages = 2, // "V", 
        HouseCall = 3, //"H"
        MoveIn = 10, // "I", 
        MoveOut = 11, // "U", 
        Juridical = 100, // "B", 
        BoU = 110 // "HD-B" 
    }
        
}
